<div>
	
</div>

<script src="http://channel.sinaapp.com/api.js"></script>
<script>
	socket = new sae.Channel("<?=$socketUrl?>");
	socket.onopen = function(res) {
	}
	socket.onmessage = function(res) {
		var data = JSON.parse(res.data);
		console.log(data);

		if(data.type == 10) {
			// 发送socket到后台客户端
			var socketData = {
				"to": data.id,
				"type": data.type,
				"msg": "http://edu.gdbohui.com/site/views/static/images/student.png"
			}
			socket.send(JSON.stringify(socketData));
		}

		if(data.type == 13) {
			// 发送socket到后台客户端
			var socketData = {
				"to": data.id,
				"type": data.type,
				"msg": "1.5.0"
			}
			socket.send(JSON.stringify(socketData));
		}

		if(data.type == 21) {
			// 发送socket到后台客户端
			var socketData = {
				"to": data.id,
				"type": data.type,
				"msg": "123"
			}
			socket.send(JSON.stringify(socketData));
		}
	}
	/*
	var ws = new WebSocket("<?=$socketUrl?>");
	ws.onopen = function(res){
		console.log('连接成功')
	}

	ws.onmessage = function (res) {
		var data = JSON.parse(res.data);
		if(data.type == 10) {
			// 发送socket到后台客户端
			var socketData = {
				"to": data.id,
				"type": data.type,
				"msg": "http://edu.gdbohui.com/site/views/static/images/student.png"
			}
			ws.send(JSON.stringify(socketData));

		}
    };
	*/
</script>